<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    let arr1 = [1, 2, 3, 5, 5, 2]
    console.log('原本的数组 ' + arr1)
    let temp = [];
    for (var i = 0; i < arr1.length; i++) {
      for (var j = i + 1; j < arr1.length; j++) {
        if (arr1[i] === arr1[j] && temp.indexOf(arr1[j] === -1)) {
          temp.push(arr1[i])
        }
      }
    }
    console.log('重复的数组 ' + temp)

  </script>
</body>

</html>